package com.sjq.supplier.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sjq.supplier.mapper.GoodsMapper;
import com.sjq.supplier.entity.Goods;
import com.sjq.supplier.service.GoodsService;
import com.sjq.supplier.util.Result;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (Goods)表服务实现类
 *
 * @author makejava
 * @since 2024-01-02 14:54:50
 */
@Service("goodsService")
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {

    @Override
    public Result selectAll(Goods goods, Integer limit, Integer page) {
        List<Map<String, Object>> list=baseMapper.selectAll(goods, (page - 1) * limit , limit);
        HashMap<String, Object> result = new HashMap<>();
        result.put("count",baseMapper.selectAllCount(goods));
        result.put("data",list);
        return Result.success(result);
    }
}

